<?php

ArrowController::importModel("mediators.IArrowMediator");
/**
 * Arrow project mediators list handle
 *
 * @version 1.0
 * @license  GNU GPL
 * @author Artur Kmera <artur.kmera@arrowplatform.org>
 */
class ArrowMediatorsList{

	/**
	 * Configuration array
	 *
	 * @var array
	 */
	private $conf;
	
	/**
	 * Constuctor
	 *
	 */
	public function __construct(){
		$this->conf = ArrowConfProvider::getDefault()->getConf(ArrowConfProvider::MEDIATORS);
	}
	
	/**	 
	 *  Returns mediator instance
	 *
	 * @param String $mediatorName
	 * @return Mediator	
	 */
	public function getMediatorInstance( $mediatorName ){
		$registred = $this->conf[$mediatorName];
		if (empty ($registred))		
		throw new ArrowCoreException(array (
				"msg" => "Mediator dosn't exists !.",
				"id" => $mediatorName
				));
		return ArrowController::getModelInstance( $registred["model"] );	}
}

?>